using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableGuestbook
	{
		public const string Table = "Guestbook";
		public const string GuestbookID = "GuestbookID";
		public const string Title = "Title";
		public const string Content = "Content";
		public const string ReceiverIDList = "ReceiverIDList";
		public const string ReceiverType = "ReceiverType";
		public const string IsAllUser = "IsAllUser";
		public const string IsReply = "IsReply";
		public const string Creater = "Creater";
		public const string CreatedBy = "CreatedBy";
		public const string Created = "Created";
		public const string Modified = "Modified";
		public const string ModifiedBy = "ModifiedBy";
		public const string ModifiedByID = "ModifiedByID";
	}
	
	[Serializable]
	public class BaseGuestbook
		: IDbSessionEntity, IJsonClass
	{
		int m_GuestbookID;
		/// <summary>
        /// 
        /// </summary>
        public int GuestbookID
        {
            get { return m_GuestbookID; }
            set { m_GuestbookID = value; }
        }
		
		string m_Title;
		/// <summary>
        /// 
        /// </summary>
        public string Title
        {
            get { return m_Title; }
            set { m_Title = value; }
        }
		
		string m_Content;
		/// <summary>
        /// 
        /// </summary>
        public string Content
        {
            get { return m_Content; }
            set { m_Content = value; }
        }
		
		string m_ReceiverIDList;
		/// <summary>
        /// 
        /// </summary>
        public string ReceiverIDList
        {
            get { return m_ReceiverIDList; }
            set { m_ReceiverIDList = value; }
        }
		
		int m_ReceiverType;
		/// <summary>
        /// 
        /// </summary>
        public int ReceiverType
        {
            get { return m_ReceiverType; }
            set { m_ReceiverType = value; }
        }
		
		bool m_IsAllUser;
		/// <summary>
        /// 
        /// </summary>
        public bool IsAllUser
        {
            get { return m_IsAllUser; }
            set { m_IsAllUser = value; }
        }
		
		bool m_IsReply;
		/// <summary>
        /// 
        /// </summary>
        public bool IsReply
        {
            get { return m_IsReply; }
            set { m_IsReply = value; }
        }
		
		int m_Creater;
		/// <summary>
        /// 
        /// </summary>
        public int Creater
        {
            get { return m_Creater; }
            set { m_Creater = value; }
        }
		
		string m_CreatedBy;
		/// <summary>
        /// 
        /// </summary>
        public string CreatedBy
        {
            get { return m_CreatedBy; }
            set { m_CreatedBy = value; }
        }
		
		DateTime m_Created;
		/// <summary>
        /// 
        /// </summary>
        public DateTime Created
        {
            get { return m_Created; }
            set { m_Created = value; }
        }
		
		DateTime m_Modified;
		/// <summary>
        /// 
        /// </summary>
        public DateTime Modified
        {
            get { return m_Modified; }
            set { m_Modified = value; }
        }
		
		string m_ModifiedBy;
		/// <summary>
        /// 
        /// </summary>
        public string ModifiedBy
        {
            get { return m_ModifiedBy; }
            set { m_ModifiedBy = value; }
        }
		
		int? m_ModifiedByID;
		/// <summary>
        /// 
        /// </summary>
        public int? ModifiedByID
        {
            get { return m_ModifiedByID; }
            set { m_ModifiedByID = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_GuestbookID = reader[TableGuestbook.GuestbookID];
            m_Title = reader[TableGuestbook.Title];
            m_Content = reader[TableGuestbook.Content];
            m_ReceiverIDList = reader[TableGuestbook.ReceiverIDList];
            m_ReceiverType = reader[TableGuestbook.ReceiverType];
            m_IsAllUser = reader[TableGuestbook.IsAllUser];
            m_IsReply = reader[TableGuestbook.IsReply];
            m_Creater = reader[TableGuestbook.Creater];
            m_CreatedBy = reader[TableGuestbook.CreatedBy];
            m_Created = reader[TableGuestbook.Created];
            m_Modified = reader[TableGuestbook.Modified];
            m_ModifiedBy = reader[TableGuestbook.ModifiedBy];
            m_ModifiedByID = reader[TableGuestbook.ModifiedByID];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableGuestbook.GuestbookID, PrimaryKeyType.Identity, GuestbookID);
			writer[TableGuestbook.Title] = Title;
			writer[TableGuestbook.Content] = Content;
			writer[TableGuestbook.ReceiverIDList] = ReceiverIDList;
			writer[TableGuestbook.ReceiverType] = ReceiverType;
			writer[TableGuestbook.IsAllUser] = IsAllUser;
			writer[TableGuestbook.IsReply] = IsReply;
			writer[TableGuestbook.Creater] = Creater;
			writer[TableGuestbook.CreatedBy] = CreatedBy;
			writer[TableGuestbook.Created] = Created;
			writer[TableGuestbook.Modified] = Modified;
			writer[TableGuestbook.ModifiedBy] = ModifiedBy;
			writer[TableGuestbook.ModifiedByID] = ModifiedByID;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_GuestbookID = idd;
        }
		
		public string TableName
        {
            get { return TableGuestbook.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_GuestbookID = hashToRead["GuestbookID"];
			 
             m_Title = hashToRead["Title"];
			 
             m_Content = hashToRead["Content"];
			 
             m_ReceiverIDList = hashToRead["ReceiverIDList"];
			 
             m_ReceiverType = hashToRead["ReceiverType"];
			 
             m_IsAllUser = hashToRead["IsAllUser"];
			 
             m_IsReply = hashToRead["IsReply"];
			 
             m_Creater = hashToRead["Creater"];
			 
             m_CreatedBy = hashToRead["CreatedBy"];
			 
             m_Created = hashToRead["Created"];
			 
             m_Modified = hashToRead["Modified"];
			 
             m_ModifiedBy = hashToRead["ModifiedBy"];
			 
             m_ModifiedByID = hashToRead["ModifiedByID"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["GuestbookID"] = GuestbookID;
			 
            hashToFill["Title"] = Title;
			 
            hashToFill["Content"] = Content;
			 
            hashToFill["ReceiverIDList"] = ReceiverIDList;
			 
            hashToFill["ReceiverType"] = ReceiverType;
			 
            hashToFill["IsAllUser"] = IsAllUser;
			 
            hashToFill["IsReply"] = IsReply;
			 
            hashToFill["Creater"] = Creater;
			 
            hashToFill["CreatedBy"] = CreatedBy;
			 
            hashToFill["Created"] = Created;
			 
            hashToFill["Modified"] = Modified;
			 
            hashToFill["ModifiedBy"] = ModifiedBy;
			 
            hashToFill["ModifiedByID"] = ModifiedByID;
			 
        }

        #endregion
		
	}
}
